import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 1. 引入你需要的组件
// 2. 引入组件样式
import getvant from './plugins';
// router.beforeEach((to,from,next)=>{
//     if(!sessionStorage.getItem('token'))
//     {
//       next('/logain')
//     }
   
//     else
//     {
//         next()
//     }
//   })
router.beforeEach((to,from,next)=>{
    if(to.name!=='logain'&&!sessionStorage.getItem('token'))
    {
     
      next('/logain') 
      store.commit('bjbottomshow',false)
    }
    if(to.name=='logain'&&sessionStorage.getItem('token'))
    {   
        next({path:from.path})
    }
    else
    {
      next();
    }
    })
const app = createApp(App);
getvant(app)
// 3. 注册你需要的组件
app.use(store)
app.use(router).mount('#app')


